<template>
  <div class="home-page">
    <section class="pl-5 text-center container">
      <div class="row py-lg-5">
        <div class="col-lg-6 col-md-8 mx-auto">
          <img src="../assets/patterns.e8579768.png" alt="" class="w-50 m-0">
          <h2 class="fint-weight-light">随心写作，自由表达</h2>
          <a href="#" class="btn btn-primary my-2">开始写文章</a>
        </div>
      </div>
    </section>
    <h4 class="font-weight-hold text-center">发现精彩</h4>
    <!--专栏列表-->
    <column-list :list="list"></column-list>
  </div>
</template>

<script lang="ts">
import { computed, defineComponent, onMounted } from 'vue'
import ColumnList from "@/components/ColumnList.vue";
import { useStore } from "vuex"; //数据仓库 所有的东西都在这里
import { GolbalDataProps } from "@/store";


export default defineComponent({
  components: {
    ColumnList
  },
  setup() {
    const store = useStore<GolbalDataProps>()
    const list = computed(() => store.state.columns)

    // 组件挂载的时候请求调用
    onMounted(() => {
      store.dispatch('fetchColumns')
    })

    return {
      list: list
    }
  }
})
</script>

<style scoped></style>